require('./index.scss');
var template = require('./template.html');
var Config = require('common/config');
var Tool = require('common/tool');
var timeZone = docCookies.getItem('timeZone') || Config.timeZone;
var comp = avalon.component('ms-footer-float', {
    template: template,
    defaults: {
        timer: "",
        timeZone: timeZone,
        timeZonList:[13,12,11,10,9,8,7,6,5,4,3,2,1,0,-1,-2,-3,-4,-5,-6,-7,-8,-9,-10,-11,-12],
        /* 切换时区 */
        changeTimeZone:function(n){
            var _zone = n<0 ? ''+n : '+'+n;
            this.timeZone = _zone;
            docCookies.setItem('timeZone',_zone, Infinity, '/');
        },
        $computed:{
            timeText: function(){
                return this.timer=='' ? '' : Tool.timeZone(this.timer);
            }
        },
        onReady(){
            var that = this;
            setInterval(function(){
                if(that.timer!='') that.timer += 1000;
            },1000);
            $(".downTrigger, .timeTrigger").on('mouseenter',function(){
                $(this).find('.triggerBox').show();
            }).on('mouseleave',function(){
                $(this).find('.triggerBox').hide();
            });
        }
    }
});

module.exports = comp;